package adv_pre;

import java.util.*;

public class Fanxing {

	public static void main(String[] args) {
		// 限制集合中对象的类型
		Set<News> set = new HashSet<News>();
		// set.add("java");
		// set.add(3.14);
		set.add(new News(15, "多过手了", "新华社发布", null));
		set.add(new News(1, "双十一花了一毛", "老刘", null));
		set.add(new News(2, "双十一花了一毛", "老朱", null));
		set.add(new News(3, "双十一花了一毛", "老吴", null));
		set.add(new News(4, "双十一花了一毛", "老赵", null));
		for (News n : set) {
			System.out.println(n.getTitle());
		}
		System.out.println(">>>>>>>>>>>>");
		Iterator<News> r = set.iterator();
		while (r.hasNext()) {
			News n = r.next();
			System.out.println(n.getTitle());
		}
	}
}
